-
-
Notifications
You must be signed in to change notification settings - Fork 406
New feature window pos #2941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature window pos #2941
Conversation
|
Unable to perform a code review. You have run out of credits 😔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces reusable helper functions restore_window_position() and save_window_position() to standardize window position persistence across pyRevit tools. The pattern is demonstrated by refactoring the "Measure 3D" tool to use these new utilities instead of inline position management code.
Key changes:
- Added
restore_window_position()andsave_window_position()helper functions inpyrevit/script.py - Refactored Measure 3D tool to use new helper functions, removing ~20 lines of duplicated code
- Removed unused
Systemimport from Measure tool
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
pyrevitlib/pyrevit/script.py |
Added two new helper functions for window position persistence with screen visibility validation |
extensions/pyRevitTools.extension/pyRevit.tab/Modify.panel/3D.pulldown/Measure.pushbutton/script.py |
Refactored to use new helper functions, removing inline window position management code and unused import |
- store width+height - reuse coreutils function
|
Great stuff Would you mind opening an issue about all the tools that could benefit from this @Wurschdhaud ? |
Description
This PR introduces new helper functions
restore_window_position()andsave_window_position()to simplify persistent window positioning across pyRevit sessions. These functions encapsulate the common pattern of storing/restoring window coordinates with screen visibility validation.Implemented in "measure 3d" for testing.
Question for reviewers: Are there better or more Windows-native solutions for handling window position persistence that I should be aware of? I'm not familiar with alternatives beyond this approach.
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}Related Issues
If applicable, link the issues resolved by this pull request:
Additional Notes
script.load_data()/script.store_data()infrastructureThank you for contributing to pyRevit! 🎉